package ac2.util;

public abstract class TemperatureReadingConverter {

	public enum TemperatureFormat
	{
		Celcius,
		Fahrenheit,
	}
	
	public double ConvertReading(int reading, TemperatureFormat outputFormat)
	{
		double temperature = 0.0;
		switch(outputFormat)
		{
		case Celcius:
			temperature = ConvertReadingToCelcius(reading);
			break;
		case Fahrenheit:
			temperature = ConvertReadingToFahrenheit(reading);
			break;
		}
		
		return temperature;
	}
	
	public int ConvertTemperature(double temperature, TemperatureFormat inputFormat)
	{
		int rawTemp = 0;
		switch(inputFormat)
		{
		case Celcius:
			rawTemp = ConvertCelciusToRaw(temperature);
			break;
		case Fahrenheit:
			rawTemp = ConvertFahrenheitToRaw(temperature);
			break;
		}
		
		return rawTemp;
	}
	
	
	public abstract double ConvertReadingToCelcius(int reading);
	public abstract double ConvertReadingToFahrenheit(int reading);
	
	public abstract int ConvertCelciusToRaw(double temperature);
	public abstract int ConvertFahrenheitToRaw(double temperature);
	
}
